.class public Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;
.super Ljava/lang/Thread;
.source "DownloadThread.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload;,
        Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;,
        Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;,
        Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    }
.end annotation


# instance fields
.field private final mContext:Landroid/content/Context;

.field private final mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

.field private final mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;


# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "systemFacade"    # Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;
    .param p3, "info"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    .prologue
    .line 56
    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    .line 57
    iput-object p1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    .line 58
    iput-object p2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    .line 59
    iput-object p3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    .line 60
    return-void
.end method

.method static synthetic access$000(Ljava/lang/String;)Ljava/lang/String;
    .registers 2
    .param p0, "x0"    # Ljava/lang/String;

    .prologue
    .line 49
    invoke-static {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->sanitizeMimeType(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private addRequestHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/client/methods/HttpGet;)V
    .registers 7
    .param p1, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p2, "request"    # Lorg/apache/http/client/methods/HttpGet;

    .prologue
    .line 877
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getHeaders()Ljava/util/Collection;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :goto_a
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_22

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/util/Pair;

    .line 878
    .local v0, "header":Landroid/util/Pair;, "Landroid/util/Pair<Ljava/lang/String;Ljava/lang/String;>;"
    iget-object v1, v0, Landroid/util/Pair;->first:Ljava/lang/Object;

    check-cast v1, Ljava/lang/String;

    iget-object v2, v0, Landroid/util/Pair;->second:Ljava/lang/Object;

    check-cast v2, Ljava/lang/String;

    invoke-virtual {p2, v1, v2}, Lorg/apache/http/client/methods/HttpGet;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_a

    .line 881
    .end local v0    # "header":Landroid/util/Pair;, "Landroid/util/Pair<Ljava/lang/String;Ljava/lang/String;>;"
    :cond_22
    iget-boolean v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mContinuingDownload:Z

    if-eqz v1, :cond_51

    .line 882
    iget-object v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    if-eqz v1, :cond_31

    .line 883
    const-string v1, "If-Match"

    iget-object v2, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    invoke-virtual {p2, v1, v2}, Lorg/apache/http/client/methods/HttpGet;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    .line 885
    :cond_31
    const-string v1, "Range"

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "bytes="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "-"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {p2, v1, v2}, Lorg/apache/http/client/methods/HttpGet;->addHeader(Ljava/lang/String;Ljava/lang/String;)V

    .line 887
    :cond_51
    return-void
.end method

.method private cannotResume(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)Z
    .registers 3
    .param p1, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;

    .prologue
    .line 484
    iget v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    if-lez v0, :cond_10

    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-boolean v0, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mNoIntegrity:Z

    if-nez v0, :cond_10

    iget-object v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    if-nez v0, :cond_10

    const/4 v0, 0x1

    :goto_f
    return v0

    :cond_10
    const/4 v0, 0x0

    goto :goto_f
.end method

.method private checkConnectivity(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Z)V
    .registers 7
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "mustWifi"    # Z
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    const/4 v3, 0x1

    .line 251
    if-nez p2, :cond_4

    .line 267
    :cond_3
    return-void

    .line 254
    :cond_4
    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->checkCanUseNetwork()I

    move-result v0

    .line 255
    .local v0, "networkUsable":I
    if-eq v0, v3, :cond_3

    .line 256
    const/16 v1, 0xc3

    .line 257
    .local v1, "status":I
    const/4 v2, 0x3

    if-ne v0, v2, :cond_24

    .line 258
    const/16 v1, 0xc4

    .line 259
    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->notifyPauseDueToSize(Z)V

    .line 264
    :cond_18
    :goto_18
    new-instance v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    .line 265
    invoke-virtual {v3, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getLogMessageForNetworkError(I)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, p0, v1, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v2

    .line 260
    :cond_24
    const/4 v2, 0x4

    if-ne v0, v2, :cond_18

    .line 261
    const/16 v1, 0xc4

    .line 262
    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    const/4 v3, 0x0

    invoke-virtual {v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->notifyPauseDueToSize(Z)V

    goto :goto_18
.end method

.method private checkPausedOrCanceled(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V
    .registers 6
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    const/16 v3, 0x1ea

    .line 387
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    monitor-enter v1

    .line 388
    :try_start_5
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v0, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mControl:I

    const/4 v2, 0x1

    if-ne v0, v2, :cond_19

    .line 389
    new-instance v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v2, 0xc1

    const-string v3, "download paused by owner"

    invoke-direct {v0, p0, v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v0

    .line 392
    :catchall_16
    move-exception v0

    monitor-exit v1
    :try_end_18
    .catchall {:try_start_5 .. :try_end_18} :catchall_16

    throw v0

    :cond_19
    :try_start_19
    monitor-exit v1
    :try_end_1a
    .catchall {:try_start_19 .. :try_end_1a} :catchall_16

    .line 393
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v0, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mStatus:I

    if-ne v0, v3, :cond_28

    .line 394
    new-instance v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const-string v1, "download canceled"

    invoke-direct {v0, p0, v3, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v0

    .line 398
    :cond_28
    return-void
.end method

.method private cleanupDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;I)V
    .registers 5
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "finalStatus"    # I

    .prologue
    .line 322
    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->closeDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V

    .line 323
    iget-object v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    if-eqz v0, :cond_1a

    invoke-static {p2}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->isStatusError(I)Z

    move-result v0

    if-eqz v0, :cond_1a

    .line 324
    new-instance v0, Ljava/io/File;

    iget-object v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    .line 325
    const/4 v0, 0x0

    iput-object v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    .line 327
    :cond_1a
    return-void
.end method

.method private closeDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V
    .registers 3
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;

    .prologue
    .line 368
    :try_start_0
    iget-object v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;

    if-eqz v0, :cond_c

    .line 369
    iget-object v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V

    .line 370
    const/4 v0, 0x0

    iput-object v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;
    :try_end_c
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_c} :catch_d

    .line 380
    :cond_c
    :goto_c
    return-void

    .line 372
    :catch_d
    move-exception v0

    goto :goto_c
.end method

.method private executeDownload(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Landroid/net/http/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)V
    .registers 9
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "client"    # Landroid/net/http/AndroidHttpClient;
    .param p3, "request"    # Lorg/apache/http/client/methods/HttpGet;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;,
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload;
        }
    .end annotation

    .prologue
    .line 225
    new-instance v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;

    const/4 v4, 0x0

    invoke-direct {v2, v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$1;)V

    .line 226
    .local v2, "innerState":Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    const/high16 v4, 0x80000

    new-array v0, v4, [B

    .line 228
    .local v0, "data":[B
    invoke-direct {p0, p1, v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->setupDestinationFile(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V

    .line 229
    invoke-direct {p0, v2, p3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->addRequestHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/client/methods/HttpGet;)V

    .line 233
    const/4 v4, 0x0

    invoke-direct {p0, p1, v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->checkConnectivity(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Z)V

    .line 235
    invoke-direct {p0, p1, p2, p3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->sendRequest(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Landroid/net/http/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)Lorg/apache/http/HttpResponse;

    move-result-object v3

    .line 236
    .local v3, "response":Lorg/apache/http/HttpResponse;
    invoke-direct {p0, p1, v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->handleExceptionalStatus(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V

    .line 242
    invoke-direct {p0, p1, v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->processResponseHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V

    .line 243
    invoke-direct {p0, p1, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->openResponseEntity(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lorg/apache/http/HttpResponse;)Ljava/io/InputStream;

    move-result-object v1

    .line 244
    .local v1, "entityStream":Ljava/io/InputStream;
    invoke-direct {p0, p1, v2, v0, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->transferData(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;[BLjava/io/InputStream;)V

    .line 245
    return-void
.end method

.method private finalizeDestinationFile(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V
    .registers 5
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .annotation build Landroid/annotation/TargetApi;
        value = 0x9
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 308
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v2, 0x9

    if-lt v1, v2, :cond_1a

    .line 309
    new-instance v0, Ljava/io/File;

    iget-object v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 310
    .local v0, "f":Ljava/io/File;
    if-eqz v0, :cond_1a

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_1a

    .line 311
    const/4 v1, 0x1

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Ljava/io/File;->setReadable(ZZ)Z

    .line 314
    .end local v0    # "f":Ljava/io/File;
    :cond_1a
    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->syncDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V

    .line 315
    return-void
.end method

.method private getFinalStatusForHttpError(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)I
    .registers 6
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;

    .prologue
    .line 807
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    invoke-static {v0}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->isNetworkAvailable(Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;)Z

    move-result v0

    if-nez v0, :cond_b

    .line 808
    const/16 v0, 0xc3

    .line 814
    :goto_a
    return v0

    .line 809
    :cond_b
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v0, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mNumFailed:I

    const/4 v1, 0x5

    if-ge v0, v1, :cond_18

    .line 810
    const/4 v0, 0x1

    iput-boolean v0, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mCountRetry:Z

    .line 811
    const/16 v0, 0xc2

    goto :goto_a

    .line 813
    :cond_18
    const-string v0, "DownloadManager"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "reached max retries for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v2, v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 814
    const/16 v0, 0x1ef

    goto :goto_a
.end method

.method private handleEndOfStream(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V
    .registers 8
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    const/4 v4, 0x0

    .line 461
    new-instance v1, Landroid/content/ContentValues;

    invoke-direct {v1}, Landroid/content/ContentValues;-><init>()V

    .line 462
    .local v1, "values":Landroid/content/ContentValues;
    const-string v2, "current_bytes"

    iget v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 463
    iget-object v2, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    if-nez v2, :cond_20

    .line 464
    const-string v2, "total_bytes"

    iget v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-virtual {v1, v2, v3}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 466
    :cond_20
    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getAllDownloadsUri()Landroid/net/Uri;

    move-result-object v3

    invoke-virtual {v2, v3, v1, v4, v4}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 469
    iget-object v2, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    if-eqz v2, :cond_50

    iget v2, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    iget-object v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    .line 471
    invoke-static {v3}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v3

    if-eq v2, v3, :cond_50

    const/4 v0, 0x1

    .line 472
    .local v0, "lengthMismatched":Z
    :goto_3e
    if-eqz v0, :cond_5e

    .line 473
    invoke-direct {p0, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->cannotResume(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)Z

    move-result v2

    if-eqz v2, :cond_52

    .line 474
    new-instance v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v3, 0x1e9

    const-string v4, "mismatched content length"

    invoke-direct {v2, p0, v3, v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v2

    .line 471
    .end local v0    # "lengthMismatched":Z
    :cond_50
    const/4 v0, 0x0

    goto :goto_3e

    .line 477
    .restart local v0    # "lengthMismatched":Z
    :cond_52
    new-instance v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->getFinalStatusForHttpError(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)I

    move-result v3

    const-string v4, "closed socket before end of file"

    invoke-direct {v2, p0, v3, v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v2

    .line 481
    :cond_5e
    return-void
.end method

.method private handleExceptionalStatus(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V
    .registers 8
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p3, "response"    # Lorg/apache/http/HttpResponse;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;,
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload;
        }
    .end annotation

    .prologue
    .line 674
    invoke-interface {p3}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v2

    invoke-interface {v2}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v1

    .line 675
    .local v1, "statusCode":I
    const/16 v2, 0x1f7

    if-ne v1, v2, :cond_16

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v2, v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mNumFailed:I

    const/4 v3, 0x5

    if-ge v2, v3, :cond_16

    .line 676
    invoke-direct {p0, p1, p3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->handleServiceUnavailable(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lorg/apache/http/HttpResponse;)V

    .line 678
    :cond_16
    const/16 v2, 0x12d

    if-eq v1, v2, :cond_26

    const/16 v2, 0x12e

    if-eq v1, v2, :cond_26

    const/16 v2, 0x12f

    if-eq v1, v2, :cond_26

    const/16 v2, 0x133

    if-ne v1, v2, :cond_29

    .line 680
    :cond_26
    invoke-direct {p0, p1, p3, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->handleRedirect(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lorg/apache/http/HttpResponse;I)V

    .line 683
    :cond_29
    iget-boolean v2, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mContinuingDownload:Z

    if-eqz v2, :cond_35

    const/16 v0, 0xce

    .line 685
    .local v0, "expectedStatus":I
    :goto_2f
    if-eq v1, v0, :cond_34

    .line 686
    invoke-direct {p0, p1, p2, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->handleOtherStatus(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;I)V

    .line 688
    :cond_34
    return-void

    .line 683
    .end local v0    # "expectedStatus":I
    :cond_35
    const/16 v0, 0xc8

    goto :goto_2f
.end method

.method private handleOtherStatus(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;I)V
    .registers 8
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p3, "statusCode"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 696
    invoke-static {p3}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->isStatusError(I)Z

    move-result v1

    if-eqz v1, :cond_20

    .line 697
    move v0, p3

    .line 706
    .local v0, "finalStatus":I
    :goto_7
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "http error "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, p0, v0, v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v1

    .line 698
    .end local v0    # "finalStatus":I
    :cond_20
    const/16 v1, 0x12c

    if-lt p3, v1, :cond_2b

    const/16 v1, 0x190

    if-ge p3, v1, :cond_2b

    .line 699
    const/16 v0, 0x1ed

    .restart local v0    # "finalStatus":I
    goto :goto_7

    .line 700
    .end local v0    # "finalStatus":I
    :cond_2b
    iget-boolean v1, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mContinuingDownload:Z

    if-eqz v1, :cond_36

    const/16 v1, 0xc8

    if-ne p3, v1, :cond_36

    .line 702
    const/16 v0, 0x1e9

    .restart local v0    # "finalStatus":I
    goto :goto_7

    .line 704
    .end local v0    # "finalStatus":I
    :cond_36
    const/16 v0, 0x1ee

    .restart local v0    # "finalStatus":I
    goto :goto_7
.end method

.method private handleRedirect(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lorg/apache/http/HttpResponse;I)V
    .registers 10
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "response"    # Lorg/apache/http/HttpResponse;
    .param p3, "statusCode"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;,
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload;
        }
    .end annotation

    .prologue
    .line 717
    iget v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRedirectCount:I

    const/4 v4, 0x5

    if-lt v3, v4, :cond_f

    .line 718
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1f1

    const-string v5, "too many redirects"

    invoke-direct {v3, p0, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v3

    .line 721
    :cond_f
    const-string v3, "Location"

    invoke-interface {p2, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v1

    .line 722
    .local v1, "header":Lorg/apache/http/Header;
    if-nez v1, :cond_18

    .line 723
    return-void

    .line 731
    :cond_18
    :try_start_18
    new-instance v3, Ljava/net/URI;

    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mUri:Ljava/lang/String;

    invoke-direct {v3, v4}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    new-instance v4, Ljava/net/URI;

    invoke-interface {v1}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v4}, Ljava/net/URI;->resolve(Ljava/net/URI;)Ljava/net/URI;

    move-result-object v3

    .line 732
    invoke-virtual {v3}, Ljava/net/URI;->toString()Ljava/lang/String;
    :try_end_31
    .catch Ljava/net/URISyntaxException; {:try_start_18 .. :try_end_31} :catch_4b

    move-result-object v2

    .line 742
    .local v2, "newUri":Ljava/lang/String;
    iget v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRedirectCount:I

    add-int/lit8 v3, v3, 0x1

    iput v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRedirectCount:I

    .line 743
    iput-object v2, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRequestUri:Ljava/lang/String;

    .line 744
    const/16 v3, 0x12d

    if-eq p3, v3, :cond_42

    const/16 v3, 0x12f

    if-ne p3, v3, :cond_44

    .line 747
    :cond_42
    iput-object v2, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mNewUri:Ljava/lang/String;

    .line 749
    :cond_44
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload;

    const/4 v4, 0x0

    invoke-direct {v3, p0, v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$1;)V

    throw v3

    .line 733
    .end local v2    # "newUri":Ljava/lang/String;
    :catch_4b
    move-exception v0

    .line 739
    .local v0, "ex":Ljava/net/URISyntaxException;
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1ef

    const-string v5, "Couldn\'t resolve redirect URI"

    invoke-direct {v3, p0, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v3
.end method

.method private handleServiceUnavailable(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lorg/apache/http/HttpResponse;)V
    .registers 7
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "response"    # Lorg/apache/http/HttpResponse;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    const v3, 0x15180

    const/16 v2, 0x1e

    .line 761
    const/4 v1, 0x1

    iput-boolean v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mCountRetry:Z

    .line 762
    const-string v1, "Retry-After"

    invoke-interface {p2, v1}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 763
    .local v0, "header":Lorg/apache/http/Header;
    if-eqz v0, :cond_21

    .line 768
    :try_start_10
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    .line 769
    iget v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    if-gez v1, :cond_2b

    .line 770
    const/4 v1, 0x0

    iput v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I
    :try_end_21
    .catch Ljava/lang/NumberFormatException; {:try_start_10 .. :try_end_21} :catch_47

    .line 785
    :cond_21
    :goto_21
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v2, 0xc2

    const-string v3, "got 503 Service Unavailable, will retry later"

    invoke-direct {v1, p0, v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v1

    .line 772
    :cond_2b
    :try_start_2b
    iget v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    if-ge v1, v2, :cond_49

    .line 773
    const/16 v1, 0x1e

    iput v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    .line 777
    :cond_33
    :goto_33
    iget v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    sget-object v2, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->sRandom:Ljava/util/Random;

    const/16 v3, 0x1f

    .line 778
    invoke-virtual {v2, v3}, Ljava/util/Random;->nextInt(I)I

    move-result v2

    add-int/2addr v1, v2

    iput v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    .line 779
    iget v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    mul-int/lit16 v1, v1, 0x3e8

    iput v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    goto :goto_21

    .line 781
    :catch_47
    move-exception v1

    goto :goto_21

    .line 774
    :cond_49
    iget v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    if-le v1, v3, :cond_33

    .line 775
    const v1, 0x15180

    iput v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I
    :try_end_52
    .catch Ljava/lang/NumberFormatException; {:try_start_2b .. :try_end_52} :catch_47

    goto :goto_33
.end method

.method private logNetworkState()V
    .registers 4

    .prologue
    .line 536
    const-string v1, "DownloadManager"

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Net "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    .line 538
    invoke-static {v0}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->isNetworkAvailable(Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;)Z

    move-result v0

    if-eqz v0, :cond_23

    const-string v0, "Up"

    :goto_17
    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 536
    invoke-static {v1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 541
    return-void

    .line 538
    :cond_23
    const-string v0, "Down"

    goto :goto_17
.end method

.method private notifyDownloadCompleted(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .registers 12
    .param p1, "status"    # I
    .param p2, "countRetry"    # Z
    .param p3, "retryAfter"    # I
    .param p4, "gotData"    # Z
    .param p5, "filename"    # Ljava/lang/String;
    .param p6, "uri"    # Ljava/lang/String;
    .param p7, "mimeType"    # Ljava/lang/String;

    .prologue
    .line 896
    const-string v0, "notifyDownloadCompleted >> status:%s, countRetry:%s, retryAfter:%s,gotData:%s,filename:%s, uri:%s,mimeType:%s"

    const/4 v1, 0x7

    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v1, v2

    const/4 v2, 0x1

    invoke-static {p2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    aput-object v3, v1, v2

    const/4 v2, 0x2

    invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    aput-object v3, v1, v2

    const/4 v2, 0x3

    invoke-static {p4}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    aput-object v3, v1, v2

    const/4 v2, 0x4

    aput-object p5, v1, v2

    const/4 v2, 0x5

    aput-object p6, v1, v2

    const/4 v2, 0x6

    aput-object p7, v1, v2

    invoke-static {v0, v1}, Lcom/zuimeia/sdk/download/utils/LogTimber;->d(Ljava/lang/String;[Ljava/lang/Object;)V

    .line 898
    invoke-direct/range {p0 .. p7}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->notifyThroughDatabase(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 900
    invoke-static {p1}, Lcom/zuimeia/sdk/download/providers/downloads/Downloads;->isStatusCompleted(I)Z

    move-result v0

    if-eqz v0, :cond_3b

    .line 901
    iget-object v0, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->sendIntentIfRequested()V

    .line 903
    :cond_3b
    return-void
.end method

.method private notifyThroughDatabase(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .registers 13
    .param p1, "status"    # I
    .param p2, "countRetry"    # Z
    .param p3, "retryAfter"    # I
    .param p4, "gotData"    # Z
    .param p5, "filename"    # Ljava/lang/String;
    .param p6, "uri"    # Ljava/lang/String;
    .param p7, "mimeType"    # Ljava/lang/String;

    .prologue
    const/4 v4, 0x0

    .line 908
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 909
    .local v0, "values":Landroid/content/ContentValues;
    const-string v1, "status"

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 910
    const-string v1, "_data"

    invoke-virtual {v0, v1, p5}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 911
    if-eqz p6, :cond_1b

    .line 912
    const-string v1, "uri"

    invoke-virtual {v0, v1, p6}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 914
    :cond_1b
    const-string v1, "mimetype"

    invoke-virtual {v0, v1, p7}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 915
    const-string v1, "lastmod"

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    .line 916
    invoke-interface {v2}, Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;->currentTimeMillis()J

    move-result-wide v2

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    .line 915
    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    .line 917
    const-string v1, "method"

    invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 918
    if-nez p2, :cond_54

    .line 919
    const-string v1, "numfailed"

    const/4 v2, 0x0

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 926
    :goto_44
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getAllDownloadsUri()Landroid/net/Uri;

    move-result-object v2

    invoke-virtual {v1, v2, v0, v4, v4}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 928
    return-void

    .line 920
    :cond_54
    if-eqz p4, :cond_61

    .line 921
    const-string v1, "numfailed"

    const/4 v2, 0x1

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    goto :goto_44

    .line 923
    :cond_61
    const-string v1, "numfailed"

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v2, v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mNumFailed:I

    add-int/lit8 v2, v2, 0x1

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    goto :goto_44
.end method

.method private openResponseEntity(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lorg/apache/http/HttpResponse;)Ljava/io/InputStream;
    .registers 8
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "response"    # Lorg/apache/http/HttpResponse;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 526
    :try_start_0
    invoke-interface {p2}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v1

    invoke-interface {v1}, Lorg/apache/http/HttpEntity;->getContent()Ljava/io/InputStream;
    :try_end_7
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_7} :catch_9

    move-result-object v1

    return-object v1

    .line 527
    :catch_9
    move-exception v0

    .line 528
    .local v0, "ex":Ljava/io/IOException;
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->logNetworkState()V

    .line 529
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->getFinalStatusForHttpError(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)I

    move-result v2

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "while getting entity: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 530
    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, p0, v2, v3, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method private processResponseHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V
    .registers 15
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p3, "response"    # Lorg/apache/http/HttpResponse;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 549
    iget-boolean v1, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mContinuingDownload:Z

    if-eqz v1, :cond_5

    .line 585
    :goto_4
    return-void

    .line 554
    :cond_5
    invoke-direct {p0, p1, p2, p3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->readResponseHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V

    .line 557
    :try_start_8
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v2, v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mUri:Ljava/lang/String;

    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v3, v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mHint:Ljava/lang/String;

    iget-object v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentDisposition:Ljava/lang/String;

    iget-object v5, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLocation:Ljava/lang/String;

    iget-object v6, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    iget-object v7, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v7, v7, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mDestination:I

    iget-object v8, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    if-eqz v8, :cond_41

    iget-object v8, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    .line 566
    invoke-static {v8}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v8

    :goto_26
    iget-object v10, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-boolean v10, v10, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mIsPublicApi:Z

    .line 557
    invoke-static/range {v1 .. v10}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->generateSaveFile(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IJZ)Ljava/lang/String;

    move-result-object v1

    iput-object v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;
    :try_end_30
    .catch Lcom/zuimeia/sdk/download/providers/downloads/Helpers$GenerateSaveFileError; {:try_start_8 .. :try_end_30} :catch_44

    .line 572
    :try_start_30
    new-instance v1, Ljava/io/FileOutputStream;

    iget-object v2, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-direct {v1, v2}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;)V

    iput-object v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;
    :try_end_39
    .catch Ljava/io/FileNotFoundException; {:try_start_30 .. :try_end_39} :catch_4f

    .line 582
    invoke-direct {p0, p1, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->updateDatabaseFromHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V

    .line 584
    const/4 v1, 0x0

    invoke-direct {p0, p1, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->checkConnectivity(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Z)V

    goto :goto_4

    .line 566
    :cond_41
    const-wide/16 v8, 0x0

    goto :goto_26

    .line 568
    :catch_44
    move-exception v0

    .line 569
    .local v0, "exc":Lcom/zuimeia/sdk/download/providers/downloads/Helpers$GenerateSaveFileError;
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    iget v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/Helpers$GenerateSaveFileError;->mStatus:I

    iget-object v3, v0, Lcom/zuimeia/sdk/download/providers/downloads/Helpers$GenerateSaveFileError;->mMessage:Ljava/lang/String;

    invoke-direct {v1, p0, v2, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v1

    .line 573
    .end local v0    # "exc":Lcom/zuimeia/sdk/download/providers/downloads/Helpers$GenerateSaveFileError;
    :catch_4f
    move-exception v0

    .line 574
    .local v0, "exc":Ljava/io/FileNotFoundException;
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v2, 0x1ec

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "while opening destination file: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 575
    invoke-virtual {v0}, Ljava/io/FileNotFoundException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, p0, v2, v3, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method private readFromResponse(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;[BLjava/io/InputStream;)I
    .registers 12
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p3, "data"    # [B
    .param p4, "entityStream"    # Ljava/io/InputStream;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    const/4 v5, 0x0

    .line 499
    :try_start_1
    invoke-virtual {p4, p3}, Ljava/io/InputStream;->read([B)I
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_4} :catch_6

    move-result v3

    return v3

    .line 500
    :catch_6
    move-exception v0

    .line 501
    .local v0, "ex":Ljava/io/IOException;
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->logNetworkState()V

    .line 502
    new-instance v2, Landroid/content/ContentValues;

    invoke-direct {v2}, Landroid/content/ContentValues;-><init>()V

    .line 503
    .local v2, "values":Landroid/content/ContentValues;
    const-string v3, "current_bytes"

    iget v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    invoke-virtual {v2, v3, v4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 504
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getAllDownloadsUri()Landroid/net/Uri;

    move-result-object v4

    invoke-virtual {v3, v4, v2, v5, v5}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 506
    invoke-direct {p0, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->cannotResume(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)Z

    move-result v3

    if-eqz v3, :cond_54

    .line 507
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "while reading response: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, ", can\'t resume interrupted download with no ETag"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 509
    .local v1, "message":Ljava/lang/String;
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1e9

    invoke-direct {v3, p0, v4, v1, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v3

    .line 512
    .end local v1    # "message":Ljava/lang/String;
    :cond_54
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->getFinalStatusForHttpError(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)I

    move-result v4

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "while reading response: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    .line 513
    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v3, p0, v4, v5, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v3
.end method

.method private readResponseHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;Lorg/apache/http/HttpResponse;)V
    .registers 10
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p3, "response"    # Lorg/apache/http/HttpResponse;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 610
    const-string v3, "Content-Disposition"

    invoke-interface {p3, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 611
    .local v0, "header":Lorg/apache/http/Header;
    if-eqz v0, :cond_e

    .line 612
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v3

    iput-object v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentDisposition:Ljava/lang/String;

    .line 614
    :cond_e
    const-string v3, "Content-Location"

    invoke-interface {p3, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 615
    if-eqz v0, :cond_1c

    .line 616
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v3

    iput-object v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLocation:Ljava/lang/String;

    .line 618
    :cond_1c
    iget-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    if-nez v3, :cond_32

    .line 619
    const-string v3, "Content-Type"

    invoke-interface {p3, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 620
    if-eqz v0, :cond_32

    .line 621
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->sanitizeMimeType(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    iput-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    .line 624
    :cond_32
    const-string v3, "ETag"

    invoke-interface {p3, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 625
    if-eqz v0, :cond_40

    .line 626
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v3

    iput-object v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    .line 628
    :cond_40
    const/4 v1, 0x0

    .line 629
    .local v1, "headerTransferEncoding":Ljava/lang/String;
    const-string v3, "Transfer-Encoding"

    invoke-interface {p3, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 630
    if-eqz v0, :cond_4d

    .line 631
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v1

    .line 633
    :cond_4d
    if-nez v1, :cond_67

    .line 634
    const-string v3, "Content-Length"

    invoke-interface {p3, v3}, Lorg/apache/http/HttpResponse;->getFirstHeader(Ljava/lang/String;)Lorg/apache/http/Header;

    move-result-object v0

    .line 635
    if-eqz v0, :cond_67

    .line 636
    invoke-interface {v0}, Lorg/apache/http/Header;->getValue()Ljava/lang/String;

    move-result-object v3

    iput-object v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    .line 637
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    .line 638
    invoke-static {v4}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J

    move-result-wide v4

    iput-wide v4, v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mTotalBytes:J

    .line 659
    :cond_67
    iget-object v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    if-nez v3, :cond_88

    if-eqz v1, :cond_75

    const-string v3, "chunked"

    .line 661
    invoke-virtual {v1, v3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v3

    if-nez v3, :cond_88

    :cond_75
    const/4 v2, 0x1

    .line 662
    .local v2, "noSizeInfo":Z
    :goto_76
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-boolean v3, v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mNoIntegrity:Z

    if-nez v3, :cond_8a

    if-eqz v2, :cond_8a

    .line 663
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1ef

    const-string v5, "can\'t know size of download, giving up"

    invoke-direct {v3, p0, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v3

    .line 661
    .end local v2    # "noSizeInfo":Z
    :cond_88
    const/4 v2, 0x0

    goto :goto_76

    .line 666
    .restart local v2    # "noSizeInfo":Z
    :cond_8a
    return-void
.end method

.method private reportProgress(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V
    .registers 12
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;

    .prologue
    const/4 v8, 0x0

    .line 404
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mSystemFacade:Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;

    invoke-interface {v3}, Lcom/zuimeia/sdk/download/providers/downloads/SystemFacade;->currentTimeMillis()J

    move-result-wide v0

    .line 405
    .local v0, "now":J
    iget v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    iget v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesNotified:I

    sub-int/2addr v3, v4

    const/16 v4, 0x1000

    if-le v3, v4, :cond_3f

    iget-wide v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mTimeLastNotification:J

    sub-long v4, v0, v4

    const-wide/16 v6, 0x5dc

    cmp-long v3, v4, v6

    if-lez v3, :cond_3f

    .line 407
    new-instance v2, Landroid/content/ContentValues;

    invoke-direct {v2}, Landroid/content/ContentValues;-><init>()V

    .line 408
    .local v2, "values":Landroid/content/ContentValues;
    const-string v3, "current_bytes"

    iget v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    invoke-virtual {v2, v3, v4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 409
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    invoke-virtual {v3}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v3

    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getAllDownloadsUri()Landroid/net/Uri;

    move-result-object v4

    invoke-virtual {v3, v4, v2, v8, v8}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 411
    iget v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    iput v3, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesNotified:I

    .line 412
    iput-wide v0, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mTimeLastNotification:J

    .line 414
    .end local v2    # "values":Landroid/content/ContentValues;
    :cond_3f
    return-void
.end method

.method private static sanitizeMimeType(Ljava/lang/String;)Ljava/lang/String;
    .registers 5
    .param p0, "mimeType"    # Ljava/lang/String;

    .prologue
    .line 941
    :try_start_0
    invoke-virtual {p0}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v2

    sget-object v3, Ljava/util/Locale;->ENGLISH:Ljava/util/Locale;

    invoke-virtual {v2, v3}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;

    move-result-object p0

    .line 943
    const/16 v2, 0x3b

    invoke-virtual {p0, v2}, Ljava/lang/String;->indexOf(I)I

    move-result v1

    .line 944
    .local v1, "semicolonIndex":I
    const/4 v2, -0x1

    if-eq v1, v2, :cond_18

    .line 945
    const/4 v2, 0x0

    invoke-virtual {p0, v2, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;
    :try_end_17
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_17} :catch_19

    move-result-object p0

    .line 949
    .end local v1    # "semicolonIndex":I
    .end local p0    # "mimeType":Ljava/lang/String;
    :cond_18
    :goto_18
    return-object p0

    .line 948
    .restart local p0    # "mimeType":Ljava/lang/String;
    :catch_19
    move-exception v0

    .line 949
    .local v0, "npe":Ljava/lang/NullPointerException;
    const/4 p0, 0x0

    goto :goto_18
.end method

.method private sendRequest(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Landroid/net/http/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)Lorg/apache/http/HttpResponse;
    .registers 9
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "client"    # Landroid/net/http/AndroidHttpClient;
    .param p3, "request"    # Lorg/apache/http/client/methods/HttpGet;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 795
    :try_start_0
    invoke-virtual {p2, p3}, Landroid/net/http/AndroidHttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;
    :try_end_3
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_3} :catch_5
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_3} :catch_25

    move-result-object v1

    return-object v1

    .line 796
    :catch_5
    move-exception v0

    .line 797
    .local v0, "ex":Ljava/lang/IllegalArgumentException;
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v2, 0x1ef

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "while trying to execute request: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 798
    invoke-virtual {v0}, Ljava/lang/IllegalArgumentException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, p0, v2, v3, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v1

    .line 799
    .end local v0    # "ex":Ljava/lang/IllegalArgumentException;
    :catch_25
    move-exception v0

    .line 800
    .local v0, "ex":Ljava/io/IOException;
    invoke-direct {p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->logNetworkState()V

    .line 801
    new-instance v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->getFinalStatusForHttpError(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)I

    move-result v2

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "while trying to execute request: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 802
    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v1, p0, v2, v3, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method private setupDestinationFile(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V
    .registers 12
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    const/16 v7, 0x1ec

    const/4 v8, 0x1

    .line 824
    iget-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-static {v4}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v4

    if-nez v4, :cond_38

    .line 827
    iget-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-static {v4}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->isFilenameValid(Ljava/lang/String;)Z

    move-result v4

    if-nez v4, :cond_1b

    .line 829
    new-instance v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const-string v5, "found invalid internal destination filename"

    invoke-direct {v4, p0, v7, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v4

    .line 833
    :cond_1b
    new-instance v1, Ljava/io/File;

    iget-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-direct {v1, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 834
    .local v1, "f":Ljava/io/File;
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v4

    if-eqz v4, :cond_38

    .line 835
    invoke-virtual {v1}, Ljava/io/File;->length()J

    move-result-wide v2

    .line 836
    .local v2, "fileLength":J
    const-wide/16 v4, 0x0

    cmp-long v4, v2, v4

    if-nez v4, :cond_46

    .line 839
    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    .line 840
    const/4 v4, 0x0

    iput-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    .line 867
    .end local v1    # "f":Ljava/io/File;
    .end local v2    # "fileLength":J
    :cond_38
    :goto_38
    iget-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;

    if-eqz v4, :cond_45

    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mDestination:I

    if-nez v4, :cond_45

    .line 869
    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->closeDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V

    .line 871
    :cond_45
    return-void

    .line 841
    .restart local v1    # "f":Ljava/io/File;
    .restart local v2    # "fileLength":J
    :cond_46
    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mETag:Ljava/lang/String;

    if-nez v4, :cond_5f

    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-boolean v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mNoIntegrity:Z

    if-nez v4, :cond_5f

    .line 843
    invoke-virtual {v1}, Ljava/io/File;->delete()Z

    .line 844
    new-instance v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v5, 0x1e9

    const-string v6, "Trying to resume a download that can\'t be resumed"

    invoke-direct {v4, p0, v5, v6}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v4

    .line 849
    :cond_5f
    :try_start_5f
    new-instance v4, Ljava/io/FileOutputStream;

    iget-object v5, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    const/4 v6, 0x1

    invoke-direct {v4, v5, v6}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V

    iput-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;
    :try_end_69
    .catch Ljava/io/FileNotFoundException; {:try_start_5f .. :try_end_69} :catch_89

    .line 856
    long-to-int v4, v2

    iput v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    .line 857
    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mTotalBytes:J

    const-wide/16 v6, -0x1

    cmp-long v4, v4, v6

    if-eqz v4, :cond_80

    .line 858
    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mTotalBytes:J

    .line 859
    invoke-static {v4, v5}, Ljava/lang/Long;->toString(J)Ljava/lang/String;

    move-result-object v4

    iput-object v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderContentLength:Ljava/lang/String;

    .line 861
    :cond_80
    iget-object v4, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mETag:Ljava/lang/String;

    iput-object v4, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    .line 862
    iput-boolean v8, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mContinuingDownload:Z

    goto :goto_38

    .line 851
    :catch_89
    move-exception v0

    .line 852
    .local v0, "exc":Ljava/io/FileNotFoundException;
    new-instance v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "while opening destination for resuming: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    .line 854
    invoke-virtual {v0}, Ljava/io/FileNotFoundException;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, p0, v7, v5, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v4
.end method

.method private syncDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V
    .registers 8
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;

    .prologue
    .line 333
    const/4 v0, 0x0

    .line 335
    .local v0, "downloadedFileStream":Ljava/io/FileOutputStream;
    :try_start_1
    new-instance v1, Ljava/io/FileOutputStream;

    iget-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    const/4 v4, 0x1

    invoke-direct {v1, v3, v4}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V
    :try_end_9
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_9} :catch_2b
    .catch Ljava/io/SyncFailedException; {:try_start_1 .. :try_end_9} :catch_68
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_9} :catch_a7
    .catch Ljava/lang/RuntimeException; {:try_start_1 .. :try_end_9} :catch_e7
    .catchall {:try_start_1 .. :try_end_9} :catchall_10a

    .line 336
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .local v1, "downloadedFileStream":Ljava/io/FileOutputStream;
    :try_start_9
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->getFD()Ljava/io/FileDescriptor;

    move-result-object v3

    invoke-virtual {v3}, Ljava/io/FileDescriptor;->sync()V
    :try_end_10
    .catch Ljava/io/FileNotFoundException; {:try_start_9 .. :try_end_10} :catch_131
    .catch Ljava/io/SyncFailedException; {:try_start_9 .. :try_end_10} :catch_12d
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_10} :catch_129
    .catch Ljava/lang/RuntimeException; {:try_start_9 .. :try_end_10} :catch_126
    .catchall {:try_start_9 .. :try_end_10} :catchall_123

    .line 349
    if-eqz v1, :cond_135

    .line 351
    :try_start_12
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
    :try_end_15
    .catch Ljava/io/IOException; {:try_start_12 .. :try_end_15} :catch_17
    .catch Ljava/lang/RuntimeException; {:try_start_12 .. :try_end_15} :catch_21

    move-object v0, v1

    .line 360
    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :cond_16
    :goto_16
    return-void

    .line 352
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catch_17
    move-exception v2

    .line 353
    .local v2, "ex":Ljava/io/IOException;
    const-string v3, "DownloadManager"

    const-string v4, "IOException while closing synced file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    move-object v0, v1

    .line 357
    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto :goto_16

    .line 355
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .end local v2    # "ex":Ljava/io/IOException;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catch_21
    move-exception v2

    .line 356
    .local v2, "ex":Ljava/lang/RuntimeException;
    const-string v3, "DownloadManager"

    const-string v4, "exception while closing file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    move-object v0, v1

    .line 357
    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto :goto_16

    .line 337
    .end local v2    # "ex":Ljava/lang/RuntimeException;
    :catch_2b
    move-exception v2

    .line 338
    .local v2, "ex":Ljava/io/FileNotFoundException;
    :goto_2c
    :try_start_2c
    const-string v3, "DownloadManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "file "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    iget-object v5, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " not found: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_50
    .catchall {:try_start_2c .. :try_end_50} :catchall_10a

    .line 349
    if-eqz v0, :cond_16

    .line 351
    :try_start_52
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_55
    .catch Ljava/io/IOException; {:try_start_52 .. :try_end_55} :catch_56
    .catch Ljava/lang/RuntimeException; {:try_start_52 .. :try_end_55} :catch_5f

    goto :goto_16

    .line 352
    :catch_56
    move-exception v2

    .line 353
    .local v2, "ex":Ljava/io/IOException;
    const-string v3, "DownloadManager"

    const-string v4, "IOException while closing synced file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_16

    .line 355
    .local v2, "ex":Ljava/io/FileNotFoundException;
    :catch_5f
    move-exception v2

    .line 356
    .local v2, "ex":Ljava/lang/RuntimeException;
    const-string v3, "DownloadManager"

    const-string v4, "exception while closing file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_16

    .line 340
    .end local v2    # "ex":Ljava/lang/RuntimeException;
    :catch_68
    move-exception v2

    .line 341
    .local v2, "ex":Ljava/io/SyncFailedException;
    :goto_69
    :try_start_69
    const-string v3, "DownloadManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "file "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    iget-object v5, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, " sync failed: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_8d
    .catchall {:try_start_69 .. :try_end_8d} :catchall_10a

    .line 349
    if-eqz v0, :cond_16

    .line 351
    :try_start_8f
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_92
    .catch Ljava/io/IOException; {:try_start_8f .. :try_end_92} :catch_93
    .catch Ljava/lang/RuntimeException; {:try_start_8f .. :try_end_92} :catch_9d

    goto :goto_16

    .line 352
    :catch_93
    move-exception v2

    .line 353
    .local v2, "ex":Ljava/io/IOException;
    const-string v3, "DownloadManager"

    const-string v4, "IOException while closing synced file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_16

    .line 355
    .local v2, "ex":Ljava/io/SyncFailedException;
    :catch_9d
    move-exception v2

    .line 356
    .local v2, "ex":Ljava/lang/RuntimeException;
    const-string v3, "DownloadManager"

    const-string v4, "exception while closing file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_16

    .line 343
    .end local v2    # "ex":Ljava/lang/RuntimeException;
    :catch_a7
    move-exception v2

    .line 344
    .local v2, "ex":Ljava/io/IOException;
    :goto_a8
    :try_start_a8
    const-string v3, "DownloadManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "IOException trying to sync "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    iget-object v5, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, ": "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_cc
    .catchall {:try_start_a8 .. :try_end_cc} :catchall_10a

    .line 349
    if-eqz v0, :cond_16

    .line 351
    :try_start_ce
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_d1
    .catch Ljava/io/IOException; {:try_start_ce .. :try_end_d1} :catch_d3
    .catch Ljava/lang/RuntimeException; {:try_start_ce .. :try_end_d1} :catch_dd

    goto/16 :goto_16

    .line 352
    :catch_d3
    move-exception v2

    .line 353
    const-string v3, "DownloadManager"

    const-string v4, "IOException while closing synced file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_16

    .line 355
    :catch_dd
    move-exception v2

    .line 356
    .local v2, "ex":Ljava/lang/RuntimeException;
    const-string v3, "DownloadManager"

    const-string v4, "exception while closing file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_16

    .line 346
    .end local v2    # "ex":Ljava/lang/RuntimeException;
    :catch_e7
    move-exception v2

    .line 347
    .restart local v2    # "ex":Ljava/lang/RuntimeException;
    :goto_e8
    :try_start_e8
    const-string v3, "DownloadManager"

    const-string v4, "exception while syncing file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_ef
    .catchall {:try_start_e8 .. :try_end_ef} :catchall_10a

    .line 349
    if-eqz v0, :cond_16

    .line 351
    :try_start_f1
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_f4
    .catch Ljava/io/IOException; {:try_start_f1 .. :try_end_f4} :catch_f6
    .catch Ljava/lang/RuntimeException; {:try_start_f1 .. :try_end_f4} :catch_100

    goto/16 :goto_16

    .line 352
    :catch_f6
    move-exception v2

    .line 353
    .local v2, "ex":Ljava/io/IOException;
    const-string v3, "DownloadManager"

    const-string v4, "IOException while closing synced file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_16

    .line 355
    .local v2, "ex":Ljava/lang/RuntimeException;
    :catch_100
    move-exception v2

    .line 356
    const-string v3, "DownloadManager"

    const-string v4, "exception while closing file: "

    invoke-static {v3, v4, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_16

    .line 349
    .end local v2    # "ex":Ljava/lang/RuntimeException;
    :catchall_10a
    move-exception v3

    :goto_10b
    if-eqz v0, :cond_110

    .line 351
    :try_start_10d
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_110
    .catch Ljava/io/IOException; {:try_start_10d .. :try_end_110} :catch_111
    .catch Ljava/lang/RuntimeException; {:try_start_10d .. :try_end_110} :catch_11a

    .line 357
    :cond_110
    :goto_110
    throw v3

    .line 352
    :catch_111
    move-exception v2

    .line 353
    .local v2, "ex":Ljava/io/IOException;
    const-string v4, "DownloadManager"

    const-string v5, "IOException while closing synced file: "

    invoke-static {v4, v5, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_110

    .line 355
    .end local v2    # "ex":Ljava/io/IOException;
    :catch_11a
    move-exception v2

    .line 356
    .local v2, "ex":Ljava/lang/RuntimeException;
    const-string v4, "DownloadManager"

    const-string v5, "exception while closing file: "

    invoke-static {v4, v5, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_110

    .line 349
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .end local v2    # "ex":Ljava/lang/RuntimeException;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catchall_123
    move-exception v3

    move-object v0, v1

    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto :goto_10b

    .line 346
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catch_126
    move-exception v2

    move-object v0, v1

    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto :goto_e8

    .line 343
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catch_129
    move-exception v2

    move-object v0, v1

    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto/16 :goto_a8

    .line 340
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catch_12d
    move-exception v2

    move-object v0, v1

    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto/16 :goto_69

    .line 337
    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :catch_131
    move-exception v2

    move-object v0, v1

    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto/16 :goto_2c

    .end local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    :cond_135
    move-object v0, v1

    .end local v1    # "downloadedFileStream":Ljava/io/FileOutputStream;
    .restart local v0    # "downloadedFileStream":Ljava/io/FileOutputStream;
    goto/16 :goto_16
.end method

.method private transferData(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;[BLjava/io/InputStream;)V
    .registers 7
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;
    .param p3, "data"    # [B
    .param p4, "entityStream"    # Ljava/io/InputStream;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 279
    :goto_0
    invoke-direct {p0, p1, p2, p3, p4}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->readFromResponse(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;[BLjava/io/InputStream;)I

    move-result v0

    .line 281
    .local v0, "bytesRead":I
    const/4 v1, -0x1

    if-ne v0, v1, :cond_b

    .line 282
    invoke-direct {p0, p1, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->handleEndOfStream(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V

    .line 283
    return-void

    .line 286
    :cond_b
    const/4 v1, 0x1

    iput-boolean v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mGotData:Z

    .line 287
    invoke-direct {p0, p1, p3, v0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->writeDataToDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;[BI)V

    .line 288
    iget v1, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    add-int/2addr v1, v0

    iput v1, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mBytesSoFar:I

    .line 289
    invoke-direct {p0, p1, p2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->reportProgress(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V

    .line 296
    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->checkPausedOrCanceled(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V

    goto :goto_0
.end method

.method private updateDatabaseFromHeaders(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;)V
    .registers 8
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "innerState"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;

    .prologue
    const/4 v4, 0x0

    .line 592
    new-instance v0, Landroid/content/ContentValues;

    invoke-direct {v0}, Landroid/content/ContentValues;-><init>()V

    .line 593
    .local v0, "values":Landroid/content/ContentValues;
    const-string v1, "_data"

    iget-object v2, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 594
    iget-object v1, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    if-eqz v1, :cond_18

    .line 595
    const-string v1, "etag"

    iget-object v2, p2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$InnerState;->mHeaderETag:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 597
    :cond_18
    iget-object v1, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    if-eqz v1, :cond_23

    .line 598
    const-string v1, "mimetype"

    iget-object v2, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 600
    :cond_23
    const-string v1, "total_bytes"

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v2, v2, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mTotalBytes:J

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Long;)V

    .line 601
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    iget-object v2, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    invoke-virtual {v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->getAllDownloadsUri()Landroid/net/Uri;

    move-result-object v2

    invoke-virtual {v1, v2, v0, v4, v4}, Landroid/content/ContentResolver;->update(Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    .line 603
    return-void
.end method

.method private userAgent()Ljava/lang/String;
    .registers 3

    .prologue
    .line 67
    iget-object v1, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-object v0, v1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mUserAgent:Ljava/lang/String;

    .line 68
    .local v0, "userAgent":Ljava/lang/String;
    if-eqz v0, :cond_6

    .line 70
    :cond_6
    if-nez v0, :cond_a

    .line 71
    const-string v0, "AndroidDownloadManager"

    .line 73
    :cond_a
    return-object v0
.end method

.method private writeDataToDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;[BI)V
    .registers 11
    .param p1, "state"    # Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    .param p2, "data"    # [B
    .param p3, "bytesRead"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
        }
    .end annotation

    .prologue
    .line 426
    :try_start_0
    iget-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;

    if-nez v3, :cond_e

    .line 427
    new-instance v3, Ljava/io/FileOutputStream;

    iget-object v4, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    const/4 v5, 0x1

    invoke-direct {v3, v4, v5}, Ljava/io/FileOutputStream;-><init>(Ljava/lang/String;Z)V

    iput-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;

    .line 429
    :cond_e
    iget-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mStream:Ljava/io/FileOutputStream;

    const/4 v4, 0x0

    invoke-virtual {v3, p2, v4, p3}, Ljava/io/FileOutputStream;->write([BII)V

    .line 430
    iget-object v3, p0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget v3, v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mDestination:I

    if-nez v3, :cond_1d

    .line 431
    invoke-direct {p0, p1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->closeDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V
    :try_end_1d
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_1d} :catch_1e

    .line 433
    :cond_1d
    return-void

    .line 434
    :catch_1e
    move-exception v2

    .line 435
    .local v2, "ex":Ljava/io/IOException;
    invoke-static {}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->isExternalMediaMounted()Z

    move-result v3

    if-nez v3, :cond_2f

    .line 436
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1f3

    const-string v5, "external media not mounted while writing destination file"

    invoke-direct {v3, p0, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;)V

    throw v3

    .line 441
    :cond_2f
    iget-object v3, p1, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    .line 442
    invoke-static {v3}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->getFilesystemRoot(Ljava/lang/String;)Ljava/io/File;

    move-result-object v3

    .line 441
    invoke-static {v3}, Lcom/zuimeia/sdk/download/providers/downloads/Helpers;->getAvailableBytes(Ljava/io/File;)J

    move-result-wide v0

    .line 443
    .local v0, "availableBytes":J
    int-to-long v4, p3

    cmp-long v3, v0, v4

    if-gez v3, :cond_48

    .line 444
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1f2

    const-string v5, "insufficient space while writing destination file"

    invoke-direct {v3, p0, v4, v5, v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v3

    .line 449
    :cond_48
    new-instance v3, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;

    const/16 v4, 0x1ec

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "while writing destination file: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    .line 450
    invoke-virtual {v2}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v3, p0, v4, v5, v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;ILjava/lang/String;Ljava/lang/Throwable;)V

    throw v3
.end method


# virtual methods
.method public run()V
    .registers 20

    .prologue
    .line 148
    const/16 v2, 0xa

    invoke-static {v2}, Landroid/os/Process;->setThreadPriority(I)V

    .line 150
    new-instance v16, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;

    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    move-object/from16 v0, v16

    invoke-direct {v0, v2}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;-><init>(Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;)V

    .line 151
    .local v16, "state":Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;
    const/4 v10, 0x0

    .line 152
    .local v10, "client":Landroid/net/http/AndroidHttpClient;
    const/16 v17, 0x0

    .line 153
    .local v17, "wakeLock":Landroid/os/PowerManager$WakeLock;
    const/16 v3, 0x1eb

    .line 156
    .local v3, "finalStatus":I
    :try_start_15
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    const-string v4, "power"

    .line 157
    invoke-virtual {v2, v4}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v14

    check-cast v14, Landroid/os/PowerManager;

    .line 158
    .local v14, "pm":Landroid/os/PowerManager;
    const/4 v2, 0x1

    const-string v4, "DownloadManager"

    invoke-virtual {v14, v2, v4}, Landroid/os/PowerManager;->newWakeLock(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;

    move-result-object v17

    .line 160
    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->acquire()V

    .line 166
    invoke-direct/range {p0 .. p0}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->userAgent()Ljava/lang/String;

    move-result-object v2

    move-object/from16 v0, p0

    iget-object v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mContext:Landroid/content/Context;

    invoke-static {v2, v4}, Landroid/net/http/AndroidHttpClient;->newInstance(Ljava/lang/String;Landroid/content/Context;)Landroid/net/http/AndroidHttpClient;

    move-result-object v10

    .line 168
    const/4 v13, 0x0

    .line 169
    .local v13, "finished":Z
    :goto_38
    if-nez v13, :cond_e8

    .line 170
    const-string v2, "DownloadManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Initiating request for download "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    move-object/from16 v0, p0

    iget-object v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v6, v5, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v4, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v2, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 172
    new-instance v15, Lorg/apache/http/client/methods/HttpGet;

    move-object/from16 v0, v16

    iget-object v2, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRequestUri:Ljava/lang/String;

    invoke-direct {v15, v2}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V
    :try_end_61
    .catch Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest; {:try_start_15 .. :try_end_61} :catch_7a
    .catch Ljava/lang/Throwable; {:try_start_15 .. :try_end_61} :catch_130
    .catchall {:try_start_15 .. :try_end_61} :catchall_19b

    .line 174
    .local v15, "request":Lorg/apache/http/client/methods/HttpGet;
    :try_start_61
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-direct {v0, v1, v10, v15}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->executeDownload(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;Landroid/net/http/AndroidHttpClient;Lorg/apache/http/client/methods/HttpGet;)V
    :try_end_68
    .catch Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$RetryDownload; {:try_start_61 .. :try_end_68} :catch_6e
    .catchall {:try_start_61 .. :try_end_68} :catchall_74

    .line 175
    const/4 v13, 0x1

    .line 179
    :try_start_69
    invoke-virtual {v15}, Lorg/apache/http/client/methods/HttpGet;->abort()V

    .line 180
    const/4 v15, 0x0

    .line 181
    goto :goto_38

    .line 176
    :catch_6e
    move-exception v2

    .line 179
    invoke-virtual {v15}, Lorg/apache/http/client/methods/HttpGet;->abort()V

    .line 180
    const/4 v15, 0x0

    .line 181
    goto :goto_38

    .line 179
    :catchall_74
    move-exception v2

    invoke-virtual {v15}, Lorg/apache/http/client/methods/HttpGet;->abort()V

    .line 180
    const/4 v15, 0x0

    throw v2
    :try_end_7a
    .catch Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest; {:try_start_69 .. :try_end_7a} :catch_7a
    .catch Ljava/lang/Throwable; {:try_start_69 .. :try_end_7a} :catch_130
    .catchall {:try_start_69 .. :try_end_7a} :catchall_19b

    .line 189
    .end local v13    # "finished":Z
    .end local v14    # "pm":Landroid/os/PowerManager;
    .end local v15    # "request":Lorg/apache/http/client/methods/HttpGet;
    :catch_7a
    move-exception v11

    .line 191
    .local v11, "error":Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
    :try_start_7b
    const-string v2, "DownloadManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Aborting request for download "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    move-object/from16 v0, p0

    iget-object v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v6, v5, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v4, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, ": "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    .line 192
    invoke-virtual {v11}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;->getMessage()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    .line 191
    invoke-static {v2, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    .line 193
    iget v3, v11, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;->mFinalStatus:I
    :try_end_a9
    .catchall {:try_start_7b .. :try_end_a9} :catchall_19b

    .line 201
    if-eqz v10, :cond_af

    .line 202
    invoke-virtual {v10}, Landroid/net/http/AndroidHttpClient;->close()V

    .line 203
    const/4 v10, 0x0

    .line 205
    :cond_af
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-direct {v0, v1, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->cleanupDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;I)V

    .line 206
    move-object/from16 v0, v16

    iget-boolean v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mCountRetry:Z

    move-object/from16 v0, v16

    iget v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    move-object/from16 v0, v16

    iget-boolean v6, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mGotData:Z

    move-object/from16 v0, v16

    iget-object v7, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v8, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mNewUri:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v9, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    move-object/from16 v2, p0

    invoke-direct/range {v2 .. v9}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->notifyDownloadCompleted(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 210
    invoke-static {}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->getInstance()Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;

    move-result-object v2

    move-object/from16 v0, p0

    iget-object v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v2, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->dequeueDownload(J)V

    .line 212
    if-eqz v17, :cond_e7

    .line 213
    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->release()V

    .line 214
    const/16 v17, 0x0

    .line 217
    .end local v11    # "error":Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest;
    :cond_e7
    :goto_e7
    return-void

    .line 187
    .restart local v13    # "finished":Z
    .restart local v14    # "pm":Landroid/os/PowerManager;
    :cond_e8
    :try_start_e8
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-direct {v0, v1}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->finalizeDestinationFile(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;)V
    :try_end_ef
    .catch Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$StopRequest; {:try_start_e8 .. :try_end_ef} :catch_7a
    .catch Ljava/lang/Throwable; {:try_start_e8 .. :try_end_ef} :catch_130
    .catchall {:try_start_e8 .. :try_end_ef} :catchall_19b

    .line 188
    const/16 v3, 0xc8

    .line 201
    if-eqz v10, :cond_f7

    .line 202
    invoke-virtual {v10}, Landroid/net/http/AndroidHttpClient;->close()V

    .line 203
    const/4 v10, 0x0

    .line 205
    :cond_f7
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-direct {v0, v1, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->cleanupDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;I)V

    .line 206
    move-object/from16 v0, v16

    iget-boolean v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mCountRetry:Z

    move-object/from16 v0, v16

    iget v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    move-object/from16 v0, v16

    iget-boolean v6, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mGotData:Z

    move-object/from16 v0, v16

    iget-object v7, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v8, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mNewUri:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v9, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    move-object/from16 v2, p0

    invoke-direct/range {v2 .. v9}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->notifyDownloadCompleted(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 210
    invoke-static {}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->getInstance()Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;

    move-result-object v2

    move-object/from16 v0, p0

    iget-object v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v2, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->dequeueDownload(J)V

    .line 212
    if-eqz v17, :cond_e7

    .line 213
    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->release()V

    .line 214
    const/16 v17, 0x0

    goto :goto_e7

    .line 195
    .end local v13    # "finished":Z
    .end local v14    # "pm":Landroid/os/PowerManager;
    :catch_130
    move-exception v12

    .line 197
    .local v12, "ex":Ljava/lang/Throwable;
    :try_start_131
    const-string v2, "DownloadManager"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "Exception for id "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    move-object/from16 v0, p0

    iget-object v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v6, v5, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v4, v6, v7}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, ": "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v2, v4}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_159
    .catchall {:try_start_131 .. :try_end_159} :catchall_19b

    .line 198
    const/16 v3, 0x1eb

    .line 201
    if-eqz v10, :cond_161

    .line 202
    invoke-virtual {v10}, Landroid/net/http/AndroidHttpClient;->close()V

    .line 203
    const/4 v10, 0x0

    .line 205
    :cond_161
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-direct {v0, v1, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->cleanupDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;I)V

    .line 206
    move-object/from16 v0, v16

    iget-boolean v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mCountRetry:Z

    move-object/from16 v0, v16

    iget v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    move-object/from16 v0, v16

    iget-boolean v6, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mGotData:Z

    move-object/from16 v0, v16

    iget-object v7, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v8, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mNewUri:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v9, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    move-object/from16 v2, p0

    invoke-direct/range {v2 .. v9}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->notifyDownloadCompleted(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 210
    invoke-static {}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->getInstance()Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;

    move-result-object v2

    move-object/from16 v0, p0

    iget-object v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v2, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->dequeueDownload(J)V

    .line 212
    if-eqz v17, :cond_e7

    .line 213
    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->release()V

    .line 214
    const/16 v17, 0x0

    goto/16 :goto_e7

    .line 201
    .end local v12    # "ex":Ljava/lang/Throwable;
    :catchall_19b
    move-exception v2

    move-object/from16 v18, v2

    if-eqz v10, :cond_1a4

    .line 202
    invoke-virtual {v10}, Landroid/net/http/AndroidHttpClient;->close()V

    .line 203
    const/4 v10, 0x0

    .line 205
    :cond_1a4
    move-object/from16 v0, p0

    move-object/from16 v1, v16

    invoke-direct {v0, v1, v3}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->cleanupDestination(Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;I)V

    .line 206
    move-object/from16 v0, v16

    iget-boolean v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mCountRetry:Z

    move-object/from16 v0, v16

    iget v5, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mRetryAfter:I

    move-object/from16 v0, v16

    iget-boolean v6, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mGotData:Z

    move-object/from16 v0, v16

    iget-object v7, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mFilename:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v8, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mNewUri:Ljava/lang/String;

    move-object/from16 v0, v16

    iget-object v9, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread$State;->mMimeType:Ljava/lang/String;

    move-object/from16 v2, p0

    invoke-direct/range {v2 .. v9}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->notifyDownloadCompleted(IZIZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    .line 210
    invoke-static {}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->getInstance()Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;

    move-result-object v2

    move-object/from16 v0, p0

    iget-object v4, v0, Lcom/zuimeia/sdk/download/providers/downloads/DownloadThread;->mInfo:Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;

    iget-wide v4, v4, Lcom/zuimeia/sdk/download/providers/downloads/DownloadInfo;->mId:J

    invoke-virtual {v2, v4, v5}, Lcom/zuimeia/sdk/download/providers/downloads/DownloadHandler;->dequeueDownload(J)V

    .line 212
    if-eqz v17, :cond_1dc

    .line 213
    invoke-virtual/range {v17 .. v17}, Landroid/os/PowerManager$WakeLock;->release()V

    .line 214
    const/16 v17, 0x0

    :cond_1dc
    throw v18
.end method
